package com.hzmg.config;

import com.hzmg.filter.factory.GatewayFilterFactory;
import com.hzmg.handler.predicate.RoutePredicates;
import com.hzmg.route.RouteDefinitionLocator;
import com.hzmg.route.RouteLocator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration()
@EnableConfigurationProperties
public class GatewayAutoConfiguration {

    @Bean
    public GatewayProperties gatewayProperties() {
        return new GatewayProperties();
    }

    @Bean
    @ConditionalOnMissingBean
    public PropertiesRouteDefinitionLocator propertiesRouteDefinitionLocator(
            GatewayProperties properties) {
        return new PropertiesRouteDefinitionLocator(properties);
    }

}
